#include <iostream>
#include <stack>
#include <string>
#include <deque>

using namespace std;

string s;

int main()
{
    deque<char> dq;
    cin >> s;
    for (auto &ch : s)
    {
        if (dq.size())
        {
            if (dq.back() == ch) 
            {
                dq.pop_back();
                continue;
            }
        }
        dq.push_back(ch);
    }

    if (dq.empty()) cout << 0;
    else {
        while (dq.size())
        {
            cout << dq.front();
            dq.pop_front();
        }
    }
    cout << endl;
    return 0;
}